﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace ZooSystem
{
    /// <summary>
    /// Логика взаимодействия для VisitorPanel.xaml
    /// </summary>
    public partial class VisitorPanel : Window
    {
        Serialization database;
        public VisitorPanel()
        {
            database = Serialization.getDatabase();
            InitializeComponent();
            if(database.AnimalsList.Count > 0){
                foreach (Animal item in database.AnimalsList)
            {
                Animals_lst.Items.Add(item);
            }
            }
            
        }

        private void Exit_Click(object sender, RoutedEventArgs e)
        {
            this.Close();
        }

        private void Info_Btn_Click(object sender, RoutedEventArgs e)
        {
            if (Animals_lst.SelectedItems.Count == 1)
            {
                Animal temp = (Animal)Animals_lst.SelectedItem;
                temp.ChangeLocation();
                MessageBox.Show(temp.GetAnimalInfo(), "Animal information", MessageBoxButton.OK);
            }
        }
    }
}
